﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

/**
 * Auth: Bjorn Carandang
 * Testbench for CMSTagParser classes.
 * */
namespace RegexTestApplication
{
    class Program
    {

        static String TestFile = "TestFile.txt";

        static void Main(string[] args)
        {

            int counter = 0;
            String everything = "";
            String line;

            // Read the file and display it line by line.
            System.IO.StreamReader file =
               new System.IO.StreamReader(TestFile);
            while ((line = file.ReadLine()) != null)
            {
                //entries.AddLast(line);
                everything += line;
                counter++;
            }

            file.Close();

            List<String> prefixes = new List<String>();
            prefixes.Add("CMSGallery");
            prefixes.Add("CMSRss");
            prefixes.Add("CMSUser");

            CMSTagParser ctp = new CMSTagParser(prefixes);

            List<Object> list = ctp.ParseTags(everything);
            foreach(Object t in list)
            {
                if (t.GetType() == Type.GetType("CMSTag"))
                {
                    CMSTag tag = (CMSTag) t;
                    String s = "\"" + tag.tagName + "\"";
                    foreach (String str in tag.h.Keys)
                    {
                        s += " " + str + "->" + tag.h[str] + "/";
                    }
                    Console.WriteLine(s);
                }
            }
            
            Console.ReadLine();
            //Should return 17 entries.
        }

        
    }
}
